import { ajax } from '../lib/ajax.js';

let txt_username = document.getElementById('txt_username');
let txt_password = document.getElementById('txt_password');
let btnReg = document.getElementById('btnReg');
let spReg = document.getElementById('spReg');

btnReg.addEventListener('click', () => {
  spReg.innerHTML = '';
  // 用户信息
  let user = {
    username: txt_username.value,
    password: txt_password.value,
  };
  // 发起请求
  ajax.post('/user', user, (data) => {
    spReg.innerHTML = data.message;
  });
});
